<template>
<div class="layerRtb layerRtb-threecolumn">
    <three-title :title="{name:'评价'}"></three-title>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "137">
        <div class="analyItem" v-for="(item,index) in projectEvaluationList" :key="index">
            <p class="analyItemTit tx-center">{{item.proname.substring(0,4)}}</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="cLightGray pr8">单号</span>
                    <span>{{item.order_no}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">项目名称</span>
                    <span :data-title="item.proname">{{item.proname.substring(0,6)}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">项目经理</span>
                    <span>{{item.pm_username}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">合同额</span>
                    <span>{{item.contract_fee / 10000}}w</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">完工日期</span>
                    <span>{{formatDate(item.create_time)}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">评价</span>
                    <span v-if="item.fraction >= 80" class="cGreen">好评</span>
                    <span v-else-if="item.fraction < 80 && item.fraction >= 60" class="cRed">中评</span>
                    <span v-else class="cRed">差评</span>
                </p>
            </div>
        </div>
    </div>
    <div class="layerRtb-footer">
        <div class="analyItem">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="cLightGray pr8">好评</span>
                    <span>{{completedMap.goodReviewCount}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">差评</span>
                    <span>{{completedMap.badReviewCount}}</span>
                </p>
                <p class="col-md-4">
                    <span class="cLightGray pr8">中评</span>
                    <span>{{completedMap.duringReviewCount}}</span>
                </p>
            </div>
        </div>
    </div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getCompletedVSecond } from '../../Resources/Api'
export default {
    data () {
        return {
            parmasExample: {
                name: '',
                age: ''
            },
            completedMap: {},
            projectEvaluationList: []
        }
    },
    created () {
        this.getCompletedVSecond()// 订单
    },
    computed: {
        ...mapGetters(['userInfo', 'leftInfo'])
    },
    methods: {
        getCompletedVSecond () {
            getCompletedVSecond({
                regionID: this.leftInfo.u_diqu
            }).then(res => {
                if (res.data.StatusCode === 0) {
                    this.projectEvaluationList = res.data.Body.projectEvaluationList
                    this.completedMap = res.data.Body.completedMap
                }
            }).catch(err => {
                console.log(err)
            })
        },
        // 时间转换
        formatDate (value) {
            let date = new Date(value)
            let y = date.getFullYear()
            let MM = date.getMonth() + 1
            MM = MM < 10 ? ('0' + MM) : MM
            let d = date.getDate()
            d = d < 10 ? ('0' + d) : d
            return y + '-' + MM + '-' + d
        }
    }
}
</script>
